PCLIBS = dbus-glib-1 gtk+-2.0 libpanelapplet-2.0
CPPFLAGS = `pkg-config --cflags $(PCLIBS)`
LDFLAGS = `pkg-config --libs $(PCLIBS)`
CFLAGS = -g
PREFIX = /usr
VERSION = 0.1.0

server_path = $(PREFIX)/lib/bonobo/servers
server_file := @PACKAGE_NAME@.server
applet_path = $(PREFIX)/lib/@PACKAGE_NAME@
applet_file := @PACKAGE_NAME@

default: applet

applet: @PACKAGE_NAME@

clean:
	rm *.o $(applet_file)

install:
	install -d $(server_path) $(applet_path)
	install -m 644 -t $(server_path) $(server_file)
	install -m 755 -t $(applet_path) $(applet_file)

devpkgs:
	sudo apt-get install libdbus-glib-1-dev libgtk2.0-dev libpanel-applet2-dev

deb: devpkgs applet
	-rm -rv build
	make install PREFIX="build${PREFIX}"
	install -d 'build/DEBIAN'
	install -m 644 -t 'build/DEBIAN' control
	dpkg -b build .

debug: $(server_path)/$(server_file)
$(server_path)/$(server_file): $(server_file)
	sudo ln -sf $(PWD)/$(server_file) $(server_path)

rbapplet.c: config.h
